package br.com.sgh.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class AcessoBD {

    private Connection con;

    public Connection getConexao() throws SQLException {
        try {
            Class.forName("org.postgresql.Driver");
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/sgh?user=postgres&password=1234");
            System.out.println("Conectou na classe conection");
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return con;
    }

    public void desconectar() {
        try {
            con.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
}
